function min_distance = MinDistFromOpponent(P,S,mode)


P_X=P{1}(1);
P_Y=P{1}(2);
min_distance = 100;

for k = 2:numel(S),
    if(S{k}{2} == P{2}), continue; end %only check opposing players
    Pk = S{k};
    Pk_X=Pk{1}(1);
    Pk_Y=Pk{1}(2);

    Pk_R=sqrt((P_Y-Pk_Y)^2+(P_X-Pk_X)^2);  % relative distance to the ball
    
    if(Pk_R<min_distance)
        min_distance = Pk_R;
    end
end

end
